#include<string.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>

#define LINE_SIZE 1024
#define FLUSH_NOW  1
#define FLUSH_LINE 2
#define FLUSH_FULL 4

struct my_FILE
{
     int flags;//缓冲方式
     int fileno;//fd文件描述符
     char cache[LINE_SIZE];//缓冲区
     size_t cap;//缓冲区大小
     int pos;//下次写入缓冲区的位置
};
typedef struct my_FILE my_FILE;
my_FILE* my_fopen(const char* path,const char* mode);
void my_fflush(my_FILE* fp);
int my_fwrite(my_FILE* fp,const char* data,int len);
void my_fclose(my_FILE* fp);
